<template>
	<view>
		<u-tabbar
			:placeholder="true"
			:value="currentTab"
			:fixed="true"
			:safeAreaInsetBottom="true"
			zIndex="9"
			activeColor="#d62222"
		>
			<u-tabbar-item text="首页" name="shop" icon="home" @click="changeTab('/pages/shop/index')"></u-tabbar-item>
			<u-tabbar-item text="发现" name="discover" icon="share" @click="changeTab('/pages/discover/index')"></u-tabbar-item>
			<u-tabbar-item text="购物车" name="cart" icon="shopping-cart" :badge="cartItemNum"
				badge-style="background:#d62222;" @click="changeTab('/pages/cart/index')">
			</u-tabbar-item>
			<u-tabbar-item text="我的" name="uc" icon="account" @click="changeTab('/pages/uc/index')"></u-tabbar-item>
		</u-tabbar>
	</view>	
</template>

<script>
export default {
	name: "XTabbar",
	props: {
		currentTab: {
			type: String,
			default: "shop"
		},
		cartItemNum: {
			type: Number,
			default: 0
		}
	},
	data() {
		return {
		}	
	},
	methods: {
		changeTab(path) {
			uni.switchTab({
				url: path
			});
		}
	}	
}	
</script>

<style lang="less">

</style>